package net.flyinggroup.si.model;

import lombok.Getter;
import lombok.ToString;

import java.util.Arrays;

@Getter
@ToString
public class DomesticCargoMessage extends CargoMessage {
    public enum Region {
        NORTH(1), SOUTH(2), EAST(3), WEST(4);

        private int value;

        Region(int value) {
            this.value = value;
        }

        public static Region fromValue(int value) {
            return Arrays.stream(Region.values())
                    .filter(region -> region.value == value)
                    .findFirst()
                    .get();
        }
    }

    private final Region region;

    public DomesticCargoMessage(Cargo cargo, Region region) {
        super(cargo);
        this.region = region;
    }
}
